package com.shengwei.truck.driver.view.adapter.mine;
import android.content.Context;
import androidx.annotation.Nullable;
import androidx.annotation.StringRes;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;
import com.shengwei.truck.driver.R;
import com.shengwei.truck.driver.view.ui.mine.msgCenter.MsgListFragment;

/*
 * 消息中心列表的ViewPager for Fragment
 */
public class MsgFragmentPagerAdapter extends FragmentPagerAdapter {
    private final Context mContext;
    @StringRes private static final int[] TAB_TITLES = new int[]{R.string.system_msg,R.string.forward_and_share};

    public MsgFragmentPagerAdapter(Context context, FragmentManager fm) {
        super(fm);
        mContext = context;
    }

    @Nullable
    @Override
    public CharSequence getPageTitle(int position) {
        return mContext.getResources().getString(TAB_TITLES[position]);
    }

    @Override
    public int getCount() {
        return TAB_TITLES.length;
    }


    @Override
    public Fragment getItem(int tabIndex) {
        Fragment fragment =  MsgListFragment.newInstance(tabIndex);
        return fragment;
    }

    @Override
    public int getItemPosition(Object object) {
        return super.getItemPosition(object);
    }

}
